﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClassLibrary1.BLL;

namespace TransactionCategoriser
{
    public partial class frmAnalyse : Form
    {
        Transaction otransaction = new Transaction();
        public frmAnalyse()
        {
            InitializeComponent();
            foreach (string sCategory in otransaction.getCategories().OrderBy(c => c))
            {
                listBox1.Items.Add(sCategory);
            }
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            lblTotal.Text = otransaction.TotalForCategory(listBox1.SelectedItem.ToString()).ToString();
        }
    }
}
